package com.ld.security.server.user.modules.ups.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ld.security.common.mybatis.base.service.*;
import com.ld.security.common.mybatis.core.wrapper.EntityWrapper;
import com.ld.security.common.tomcat.util.SessionUtil;
import com.ld.security.server.user.modules.ups.mapping.UpsUserMapping;
import com.ld.security.server.user.modules.ups.service.IUpsUserService;

import com.ld.security.server.user.modules.ups.entity.UpsUserEntity;

import com.ld.security.server.user.modules.ups.service.IUpsUserService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class UpsUserServiceImpl  extends ISuperServiceImpl<UpsUserEntity>
implements
        IUpsUserService {

        @Autowired
        UpsUserMapping upsUserMapping;


        @Override
        public UpsUserEntity getByIp(String ip ) {
                QueryWrapper qw = new QueryWrapper<>()
                        .eq("ip",ip)
                        .eq("sys_user_id","-1")
                        ;
                UpsUserEntity val =  upsUserMapping.selectOne(qw);
                return val;
        }

        @Override
        public UpsUserEntity getByUserId(String userId) {
                QueryWrapper qw = new QueryWrapper<>().eq("sys_user_id",userId);
                UpsUserEntity val =  upsUserMapping.selectOne(qw);
                return val;
        }
}
